Socket
Socket
Sign inDemoInstall

get-own-enumerable-keys

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    get-own-enumerable-keys

Like `Object.keys()` but also includes symbols


Version published
Maintainers
1
Install size
3.58 kB
Created

Readme

Source

get-own-enumerable-keys

Like Object.keys() but also includes symbols

Object.keys() returns the own enumerable keys of an object except symbols (for legacy reasons). This package includes symbols too.

Use Reflect.ownKeys() if you also want non-enumerable keys.

Install

npm install get-own-enumerable-keys

Usage

import getOwnEnumerableKeys from 'get-own-enumerable-keys';

const symbol = Symbol('x');

const object = {
	foo: true,
	[symbol]: true,
};

Object.keys(object);
// ['foo']

getOwnEnumerableKeys(object);
//=> ['foo', Symbol('x')]

Keywords

FAQs

Last updated on 16 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc